package com.yy.micro.magic.ext.filter;

import com.yy.micro.magic.core.annotation.Filter;
import com.yy.micro.magic.core.filter.DynamicRuleMagicFilter;
import com.yy.micro.magic.core.model.RuntimeMetadata;
import com.yy.micro.magic.core.provider.ResourceProviderFactory;
import com.yy.micro.magic.ext.domain.filter.DynamicTrigger;

import org.springframework.beans.factory.annotation.Autowired;

@Filter("dynamicCondition")
public class DynamicTriggerMagicFilter extends DynamicRuleMagicFilter {

    @Autowired
    private ResourceProviderFactory factory;

    @Override
    public DynamicTrigger getTrigger(final RuntimeMetadata metadata) {
        return factory.findDynamicTrigger(metadata.getPlanCode(),metadata.getKey());
    }
}
